﻿import ctypes
import pygetwindow as gw


class Win32Api:

    def get_2048_window_handles(self):
        return gw.getWindowsWithTitle("新2048")[0]._hWnd

    def open_2048_window(self):
        handles_2048 = gw.getWindowsWithTitle("新2048")[0]._hWnd
        ctypes.windll.user32.SetForegroundWindow(handles_2048)
        return handles_2048
